import java.util.HashMap;
import java.util.Objects;

/**
 * Created with IntelliJ IDEA.
 * User: 12629
 * Date: 2021/11/16
 * Time: 10:22
 * Description:
 */
class Person {
    public String id;

    public Person(String id) {
        this.id = id;
    }

    @Override
    public String toString() {
        return "Person{" +
                "id='" + id + '\'' +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        Person person = (Person) o;
        return Objects.equals(id, person.id);
    }

    @Override
    public int hashCode() {
        return Objects.hash(id);
    }
}

public class TestDemo {

    public static void main(String[] args) {
        HashMap<String,String> map = new HashMap<>();

        Person person1 = new Person("1");
        Person person2 = new Person("1");
        HashBuck2<Person,String> hashBuck = new HashBuck2<>();
        hashBuck.push(person1,"gaobo");

        String name = hashBuck.get(person2);
        System.out.println(name);
    }

    public static void main2(String[] args) {
        Person person1 = new Person("1");
        Person person2 = new Person("1");
        System.out.println(person1.hashCode());
        System.out.println(person2.hashCode());
    }

    public static void main1(String[] args) {
        HashBuck hashBuck = new HashBuck();
        hashBuck.push(1,1);
        hashBuck.push(12,12);
        hashBuck.push(3,3);
        hashBuck.push(4,4);
        hashBuck.push(14,14);
        hashBuck.push(6,6);
        hashBuck.push(7,7);
        hashBuck.push(8,8);
        int ret = hashBuck.get(14);
        System.out.println(ret);
    }
}
